﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UIFramework;

namespace FieldServices
{
    public partial class frmServicesOrder : UIForm
    {
        private string _OrderID;
        private DataTable dt;

        public frmServicesOrder(string Order, string Customer)
        {
            InitializeComponent();
        }

        public frmServicesOrder(string strOrder)
        {
            InitializeBtnMapIt(0, 0, "MapIt", 38, 20);
            InitializeComponent();
            this._OrderID = strOrder;
            this.DisplayOrderDetail(_OrderID);
        }

        private void InitializeBtnMapIt(int left, int top, string imageFile, int wide1, int height1)
        {
            this.Canvas.AddElement<ImageElement>(() => new ImageElement()
            {
                Source = @"Images\button.png",
                Top = top,
                Left = left,
                AlphaChannel = true,
                Width = wide1,
                Height = height1,
            });
        }
        private void btnNotification_Click(object sender, EventArgs e)
        {
            frmNotificationDetail frm = new frmNotificationDetail(this._OrderID);
            frm.Show();

        }
        private void DisplayOrderDetail(string strOrder)
        {
            DataSet ds = Common.dsItems;
            dt = ds.Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {

                if (dt.Rows[i]["ORDERID"].ToString() == strOrder)
                {
                    this.lblOrder.Text = dt.Rows[i]["ORDERID"].ToString();
                    this.lblPhone.Text = dt.Rows[i]["TELEPHONE"].ToString();
                    //this.lblRegion.Text = dt.Rows[i]["TELEPHONE"].ToString();
                    this.lblType.Text = dt.Rows[i]["ORDER_TYPE"].ToString();
                    this.lblStreet.Text = dt. Rows[i]["STREET"].ToString();
                   // this.lblEquipment.Text =  read from table2
                }
              

            }
        }

        private void btnOperation_Click(object sender, EventArgs e)
        {
            frmOperation frm = new frmOperation();
            frm.Show();
        }

       

    }
}